import {createSlice,configureStore} from '@reduxjs/toolkit';
//创建一个状态分片
const counterSlice = createSlice({
    name:'counter',//  combineReducer({counter:counter})
    initialState:{number:0}, //此状态分片的初始状态
    reducers:{//处理器函数
        increment:state=>({number:state.number+1}),//
        decrement:state=>({number:state.number-1})
    }
});
const {actions,reducer:counter} = counterSlice;
const reducer = {//reducers 合并reducer的时候的那个reducers
    counter
}
//创建仓库
const store = configureStore({
   reducer
});
export {
    store,
    actions
}
